<?php

require_once 'OAuth/Http.php';

require_once 'Net/URL2.php';

class OAuth_Http_UserAuthorisation extends OAuth_Http
{

    public function getUrl()
    {
        $params = $this->assembleParams();
        $url = $this->_consumer->getUserAuthorisationUrl();
        // small fudge - what if URL already has a query string?
        $url = $url . '?' . $this->_httpUtility->toEncodedQueryString($params);
        return $url;
    }

    public function assembleParams()
    {
        $params = array();
        $params['oauth_token'] = $this->_consumer->getLastRequestToken()->getToken();
        $params['oauth_callback'] = $this->_consumer->getLocalUrl();
        if (!empty($this->_parameters)) {
            $params = array_merge($params, $this->_parameters);
        }
        return $params;
    }

}